home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Add-Ons / After Dark / Twist 1.0b1 / GraphicsModule.c < prev    next >
C/C++ Source or Header  |  1996-07-05  |  2KB  |  87 lines

  1. /*
  2.     JustOvals.c
  3.     
  4.     CodeWarior version.
  5.     
  6.     This file provides a generic interface for writing a After Dark™ graphics module.
  7.     The function "main" is called by After Dark and passed four parameters:
  8.     
  9.         storage:    A Handle to memory you have allocated.
  10.         blankRgn:    A region covering all screens.
  11.         message:    A value indicating which function to call.
  12.         params:        A pointer to a structure containing useful information.
  13.         
  14.     To use it, write the five routines:
  15.     
  16.     OSErr DoInitialize(Handle *storage, RgnHandle blankRgn, GMParamBlockPtr params);
  17.     OSErr DoClose(Handle storage, RgnHandle blankRgn, GMParamBlockPtr params);
  18.     OSErr DoBlank(Handle storage, RgnHandle blankRgn, GMParamBlockPtr params);
  19.     OSErr DoDrawFrame(Handle storage, RgnHandle blankRgn, GMParamBlockPtr params);
  20.     OSErr DoSetUp(RgnHandle blankRgn, short message, GMParamBlockPtr params);
  21.     
  22.     For more information, consult the programmer's section of the manual.
  23.     
  24.     The following people are all conspirators in this code:
  25.         Patrick Beard
  26.         Bruce Burkhalter
  27.         Colin Glassey
  28.         Andrew Armstrong
  29.     
  30.     ©1989-1995 Berkeley Systems, Inc.
  31.  */
  32.  
  33. #include <QuickDraw.h>
  34. #include "GraphicsModule_Types.h"
  35. #include "ADTestbed.h"
  36. #include "MessageHandlers.h"
  37.  
  38. #undef AD_TESTBED
  39.  
  40. #ifdef AD_TESTBED
  41. pascal OSErr ADEntry(Handle *storage, RgnHandle blankRgn, short message, GMParamBlockPtr params)
  42. #else
  43. pascal OSErr main(Handle *storage, RgnHandle blankRgn, short message, GMParamBlockPtr params)
  44. #endif
  45. {
  46.     OSErr err=noErr;
  47.  
  48.     /* dispatch message to appropriate routine. */
  49.     switch(message) {
  50.         case Initialize:
  51.             err = DoInitialize(storage, blankRgn, params);
  52.             break;
  53.         
  54.         case Close:
  55.             err = DoClose(*storage, blankRgn, params);
  56.             break;
  57.         
  58.         case Blank:
  59.             err = DoBlank(*storage, blankRgn, params);
  60.             break;
  61.             
  62.         case DrawFrame:
  63.             err = DoDrawFrame(*storage, blankRgn, params);
  64.             break;
  65.         
  66.         /*    There are other messages that can be passed to you. We aren't going to handle them
  67.             but I've included them to make your life simpler.
  68.         
  69.         case ModuleSelected:
  70.             err=DoSelected(*storage, blankRgn, params);
  71.             break;
  72.             
  73.         case DoAbout:
  74.             err=DoAbout(*storage, blankRgn, params);
  75.             break;
  76.         */
  77.  
  78.         default:                            // Check to see if the user pressed a button
  79.             if(message>=ButtonMessage) {
  80.                 err=DoButton(blankRgn, message, params);
  81.             }
  82.             break;
  83.         
  84.     } /* end switch */
  85.     return err;
  86. }
  87.